<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

use App\Http\Controllers\AttendanceController;
use App\Http\Controllers\ConfigController;
use App\Http\Controllers\EgressController;
use App\Http\Controllers\AbsenceController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\SummaryController;
use App\Http\Controllers\TeambitionController;
use App\Http\Controllers\PersonalController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\ManagementController;
use App\Http\Controllers\TransportationController;
use Dingo\Api\Routing\Router;

$router->get('/', function () use ($router) {
    return $router->app->version();
});

$router->get('/oauth/token', 'AuthController@getToken');
$router->get('/transportation/import',"TransportationController@import");
$router->get('/attendance/export',"AttendanceController@export");

$api = app(Router::class);

$api->version('v1', function (Router $router) {
//    $router->group(['middleware' => ['client']], function (Router $router) {
    $router->group([], function (Router $router) {
        $router->resource('/config', ConfigController::class . '@getConfig');
        $router->resource('/users', UserController::class, ['only' => ['index', 'show', 'update', 'store' ,'destroy']]);
        $router->resource('/transportation',TransportationController::class,['only'=>['index','show','update']]);
        $router->resource('/egress', EgressController::class, ['only' => ['index', 'store' ,'destroy']]);
        $router->resource('/absence', AbsenceController::class, ['only' => ['index', 'store' ,'destroy']]);
        $router->resource('/attendance', AttendanceController::class, ['only' => ['index', 'store' ,'destroy']]);
        $router->resource('/management', ManagementController::class, ['only' => ['index', 'update','show','store','destroy']]);
        $router->resource('/teambition', TeambitionController::class, ['only' => ['index']]);
        $router->get('/personal/total', PersonalController::class . '@total');
        $router->get('/personal/trend', PersonalController::class . '@trend');
        $router->resource('/summary', SummaryController::class, ['only' => ['index']]);
        $router->get('/home/clenderror', HomeController::class. '@clendError');
        $router->get('/home/attendance', HomeController::class. '@attendance');
        $router->get('/home/seventotal', HomeController::class. '@sevenTotal');
        $router->get('/home/seventotal/department', HomeController::class. '@sevenTotalDepartment');


    });

});

